home *** CD-ROM | disk | FTP | other *** search
- Path: ac.dal.ca!cook
- Newsgroups: comp.lang.c++
- Subject: Function template problem
- Message-ID: <1996Jan1.121642.44508@ac.dal.ca>
- From: cook@is.dal.ca (Adrian Ross Cook)
- Date: 1 Jan 96 12:16:41 -0400
- Nntp-Posting-Host: is.dal.ca
- X-Newsreader: TIN [version 1.2 PL2]
-
- Hi there. Is it legal to use a template function as a member function of
- a non-template class? If so, what is the proper syntax for doing this?
-
- Currently I have something like the following:
-
- class Blah{
- ...other functions...
- template <class Type>
- Type foo(int index, Type aVal);
- };
-
- and in my definitions file:
-
- template <class Type>
- Type Blah::foo(int index, Type aVal)
- {
- ...code...
- }
-
- Anyway, my compiler (Turbo C++ for Windows 3.1) won't accept this. It
- seems to be confusing my function template with a class template.
- However, none of the C++ books I have say that you can't use a template
- function as a class member function.
-
- If anyone has encountered this kind of problem, I'd like to hear from
- you. E-mail responses are preferred.
-
- Thanks,
- Adrian Cook
- cook@ug.cs.dal.ca cook@is.dal.ca
-
-